/*
 * $Id: InfoStructureLoader.java 112 2009-07-01 11:33:10Z donbeave $
 */

package labour.manager.client.data;

import labour.concept.client.data.Locale;
import labour.concept.client.data.ObjectText;
import labour.concept.engine.client.data.Site;

import com.extjs.gxt.ui.client.data.BaseTreeLoader;
import com.extjs.gxt.ui.client.data.DataProxy;
import com.extjs.gxt.ui.client.data.ModelData;

public class InfoStructureLoader extends BaseTreeLoader<ModelData> {

  @SuppressWarnings("unchecked")
  public InfoStructureLoader(DataProxy proxy) {
    super(proxy);
  }

  public boolean hasChildren(ModelData parent) {
    if (parent instanceof Site) {
      return true;
    }
    else if (parent instanceof Locale) {
      return true;
    }
    else if (parent instanceof ObjectText) {
      return ((ObjectText) parent).getObject().hasChildren();
    }
    return false;
  }

}
